package com.group4.datafactorybackend.entity.DTO;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
 * @author xin
 * @date 2022/7/2
 * @description 新增、修改码表接收参数实体类 TODO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CreateOrUpdateStopwatchDTO {

    /**
     * 码表编号
     */
    @Length(max = 8, message = "码表编号长度不能超过8")
    private String stopwatchCode;

    /**
     * 码表名称
     */
    @Pattern(regexp = "^[a-zA-Z\\u4e00-\\u9fa5]*$",message = "中文名称只支持中文及英文大小写")
    @Length(max = 30, message = "码表名称长度不能超过30")
    @NotBlank(message = "码表名称不能为空")
    private String stopwatchName;

    /**
     * 码表说明
     */
    @Length(max = 200, message = "码表说明长度不能超过200")
    private String stopwatchIllustrate;

    /**
     * 码表配置
     */
    @Valid
    @NotEmpty(message = "码表配置不能为空")
    private List<StopwatchConfigDTO> configList;
}
